package com.rongcheng.forfeature.stores;

import com.rongcheng.forfeature.actions.Action;
import com.squareup.otto.Bus;

/**
 * Created by frc on 16-10-31.
 */

public abstract class Store {
    private static final Bus bus = new Bus();

    protected Store() {
    }

    public void register(final Object view) {
        this.bus.register(view);
    }

    public void unRegister(final Object view) {
        this.bus.unregister(view);
    }

    void emitStoreChange() {
        this.bus.post(changeEvent());
    }

    protected abstract StoreChangeEvent changeEvent();

    public abstract void onAction(Action action);

    public class StoreChangeEvent {
    }


}
